package vip.xiaonuo.biz.modular.lancerBrand.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.biz.modular.lancerBrand.service.BizBrandService;
import vip.xiaonuo.biz.modular.pojo.domain.BizBrand;
import vip.xiaonuo.biz.modular.pojo.dto.common.CommonDetailDTO;
import vip.xiaonuo.biz.modular.pojo.dto.edit.BrandEditDTO;
import vip.xiaonuo.common.pojo.CommonResult;

import javax.validation.Valid;

@Api(tags = "品牌管理(B端)")
@ApiSupport(author = "LANCER_TEAM", order = 1)
@Validated
@RestController
@RequestMapping
public class BusBrandController {
    @Autowired
    private BizBrandService brandService;

    @ApiOperationSupport(order = 2)
    @ApiOperation("品牌详情查询")
    @GetMapping("/biz/business/brand/detail")
    public CommonResult<BizBrand> detail(@Valid CommonDetailDTO dto) {
        BizBrand res = brandService.detail(dto);
        return CommonResult.data(res);
    }

    @ApiOperationSupport(order = 5)
    @ApiOperation("品牌编辑")
    @PostMapping("/biz/business/brand/edit")
    public CommonResult<String> edit(@Valid BrandEditDTO dto) {
        brandService.editBus(dto);
        return CommonResult.ok();
    }
}